* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #2c3e50;
    margin: 0;
}

.header-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

/* 类型选择器样式 */
.type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.type-selector label {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.type-selector input[type="radio"] {
    display: none;
}

.type-selector input[type="radio"]:checked + label {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* 主内容区域样式 */
.main-content {
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

.input-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.card-title {
    color: #2c3e50;
    margin: 0;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background-color: #f8f9fa;
    color: #2c3e50;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.chart-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 400px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
}

.income {
    color: #2ecc71;
}

.expense {
    color: #e74c3c;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .charts {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        display: block;
        overflow-x: auto;
    }
}

#loginContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.login-form {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-form h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn {
    width: 100%;
    margin-top: 10px;
}

.login-form .switch-form {
    text-align: center;
    margin-top: 15px;
    color: #3498db;
    cursor: pointer;
}

.login-form .switch-form:hover {
    text-decoration: underline;
}

.personal-center {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 30px;
    margin: 20px auto;
    max-width: 1200px;
}

.personal-info {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.personal-info h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 24px;
}

#userInfo {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

#userInfo p {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 16px;
}

#userInfo p:last-child {
    margin-bottom: 0;
}

.personal-stats {
    margin-top: 30px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.personal-stats h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.stat-card p {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
    margin: 0;
}

.back-btn {
    padding: 10px 20px;
    background-color: #2980b9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.detailed-stats {
    margin-top: 30px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.detailed-stats h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

.detailed-stats .stats-grid {
    margin-bottom: 20px;
}

.detailed-stats h4 {
    color: #2c3e50;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.detailed-stats ul {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.detailed-stats li {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 5px;
    font-size: 14px;
}

.category-management {
    margin-top: 50px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.category-management h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

.add-category-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.add-category-form .form-control {
    flex: 1;
    min-width: 150px;
}

.category-management ul {
    list-style: none;
    padding: 0;
}

.category-management li {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.category-management li .category-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.category-management li .edit-category-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    flex-wrap: wrap;
}

.category-management li .edit-category-input {
    flex: 1;
    min-width: 100px;
}

.budget-management {
    margin-top: 50px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.budget-management h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

.budget-management table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 关键：让三列等宽 */
    margin-top: 10px;
}

.budget-management th,
.budget-management td {
    text-align: center;
    padding: 10px 0;
    font-size: 16px;
}



.budget-management th:last-child,
.budget-management td:last-child {
    width: 80px;
    min-width: 60px;
    text-align: center;
    display: table-cell;
    padding: 8px 4px;
}

.budget-management td:last-child .delete-btn {
    width: auto;
}

.budget-management tr:hover {
    background-color: #f8f9fa;
}

.budget-management .budget-input {
    width: 50px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    vertical-align: middle;
}

.budget-management td {
    vertical-align: middle;
}

.budget-management td:last-child {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

@media (max-width: 768px) {
    .personal-center {
        margin: 10px;
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .records {
        overflow-x: auto;
    }
    
    .records table {
        min-width: 600px;
    }
}

/* 最近记录样式 */
.records {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.records h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

.records table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.records th,
.records td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.records th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

.records tr:hover {
    background-color: #f8f9fa;
}

#importBtn {
    opacity: 0.5;
    cursor: not-allowed;
}

#importBtn:not(:disabled) {
    opacity: 1;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.delete-btn {
    padding: 5px 10px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.delete-btn:hover {
    background-color: #c0392b;
}

/* 导航按钮样式 */
.header-buttons .action-btn {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-buttons .action-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.header-buttons .action-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.header-buttons .action-btn#logoutBtn {
    background-color: #e74c3c;
}

.header-buttons .action-btn#logoutBtn:hover {
    background-color: #c0392b;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .header-buttons {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-buttons .action-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

/* Budget comparison list styling */
.budget-comparison ul {
    list-style: none;
    padding: 0;
}

.budget-comparison li {
    background-color: #f8f9fa; /* Light gray background */
    border: 1px solid #e9ecef; /* Light border */
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}

.budget-comparison li strong {
    color: #2c3e50; /* Darker color for category name if needed */
}

/* Styles for the budget comparison table */
.budget-comparison table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px; /* Add some space above the table */
    background-color: white; /* Set background color to white */
}

.budget-comparison th,
.budget-comparison td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee; /* Separator between rows */
}

.budget-comparison th {
    background-color: #f8f9fa; /* Light background for headers */
    color: #2c3e50; /* Darker color for headers */
    font-weight: 600; /* Bold headers */
}

.budget-comparison tr:hover {
    background-color: #f8f9fa; /* Highlight rows on hover */
}

.filter-section {
    display: flex; /* Use flexbox */
    gap: 10px; /* Add space between items */
    margin-bottom: 20px;
    align-items: center; /* Vertically align items */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

.filter-section .form-control {
    min-width: 150px; /* Minimum width for form controls */
}

.filter-section #filterCategory, 
.filter-section #filterType {
    width: 150px; /* Increased fixed width */
    min-width: 120px; /* Increased minimum width */
}

/* Style for the search input */
.filter-section #searchKeyword {
    flex: none; /* Prevent it from growing */
    width: 200px; /* Set a fixed width, adjust as needed */
}

/* Style for the amount filter group */
.filter-section .amount-filter-group {
    display: flex; /* Use flexbox for this group */
    align-items: center; /* Vertically align items */
    gap: 5px; /* Add a small gap between the inputs and the hyphen */
    flex: 1; /* Allow this group to grow within the filter-section */
    min-width: 200px; /* Ensure the group has a minimum width */
}

.filter-section .amount-filter-group .form-control {
    flex: 1; /* Allow inputs within the group to share space */
    min-width: 80px; /* Minimum width for individual amount inputs */
}

.filter-section span {
    /* Style for the '-' between amount inputs */
    padding: 0 5px;
}

/* Style for the second row filter elements */
.filter-section .second-row-filters {
    display: flex; /* Use flexbox for the second row */
    align-items: center; /* Vertically align items */
    gap: 10px; /* Add space between elements */
    flex-wrap: wrap; /* Allow wrapping */
    margin-top: 10px; /* Add some space above the second row */
}

.filter-section .second-row-filters .form-control, 
.filter-section .second-row-filters .btn {
     flex: 1; /* Allow form controls and buttons to grow */
     min-width: 120px; /* Minimum width for these elements */
}

.records h3 {
    margin-bottom: 15px;
}

.filter-section {
    display: flex; /* Use flexbox */
    gap: 10px; /* Add space between items */
    margin-bottom: 20px;
    align-items: center; /* Vertically align items */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

.filter-section .form-control {
    min-width: 150px; /* Minimum width for form controls */
}

.filter-section span {
    /* Style for the '-' between amount inputs */
    padding: 0 5px;
}

.records table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.records th,
.records td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.records th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

.records tr:hover {
    background-color: #f8f9fa;
} 